<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>新建部门</title>
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
<script src="../public/layui/layui.js" charset="utf-8"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
	<legend><h2>新部门信息</h2></legend>
</fieldset>
<form action="" method="post" class="layui-form">
		<div class="layui-form-item">
		    <label class="layui-form-label">新部门名：</label>
		    <div class="layui-input-block">
		    	<input type="text" name="deptname" lay-verify="required" lay-reqtext="不能为空！" placeholder="新部门名字" autocomplete="off" class="layui-input" style="width:500px;">
		   	</div>
		</div>
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
			<legend><h4>经理标准</h4></legend>
		</fieldset>
			<input type="text" style="display:none" name="roleid_1" value="1">
			<input type="text" style="display:none" name="rolename_1" value="经理">
		<div class="layui-form-item">
		    <label class="layui-form-label">基本薪资：</label>
		    <div class="layui-input-block">
		    	<input type="text" name="basewages_1" lay-verify="required" lay-reqtext="不该为空！" placeholder="部门初始底薪" autocomplete="off" class="layui-input" style="width:500px;">
		   	</div>
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">加班加薪标准：</label>
		    <div class="layui-input-block">
		    	<input type="text" name="overtimestandard_1" lay-verify="required" lay-reqtext="不该为空！" placeholder="部门初始加班薪资标准（每小时）" autocomplete="off" class="layui-input" style="width:500px;">
		   	</div>
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">请假扣薪标准：</label>
		    <div class="layui-input-block">
		    	<input type="text" name="leavestandard_1" lay-verify="required" lay-reqtext="不该为空！" placeholder="部门初始请假扣薪标准（每次）" autocomplete="off" class="layui-input" style="width:500px;">
		   	</div>
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">旷工标准：</label>
		    <div class="layui-input-block">
		    	<input type="text" name="absentstandard_1" lay-verify="required" lay-reqtext="不该为空！" placeholder="部门初始旷工扣薪标准（每次）" autocomplete="off" class="layui-input" style="width:500px;">
		   	</div>
		</div>
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
			<legend><h4>普通职工标准</h4></legend>
		</fieldset>
			<input type="text" style="display:none" name="roleid_2" value="2">
			<input type="text" style="display:none" name="rolename_2" value="普通职工">
		<div class="layui-form-item">
		    <label class="layui-form-label">基本薪资：</label>
		    <div class="layui-input-block">
		    	<input type="text" name="basewages_2" lay-verify="required" lay-reqtext="不该为空！" placeholder="部门初始底薪" autocomplete="off" class="layui-input" style="width:500px;">
		   	</div>
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">加班加薪标准：</label>
		    <div class="layui-input-block">
		    	<input type="text" name="overtimestandard_2" lay-verify="required" lay-reqtext="不该为空！" placeholder="部门初始加班薪资标准（每小时）" autocomplete="off" class="layui-input" style="width:500px;">
		   	</div>
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">请假扣薪标准：</label>
		    <div class="layui-input-block">
		    	<input type="text" name="leavestandard_2" lay-verify="required" lay-reqtext="不该为空！" placeholder="部门初始请假扣薪标准（每次）" autocomplete="off" class="layui-input" style="width:500px;">
		   	</div>
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">旷工标准：</label>
		    <div class="layui-input-block">
		    	<input type="text" name="absentstandard_2" lay-verify="required" lay-reqtext="不该为空！" placeholder="部门初始旷工扣薪标准（每次）" autocomplete="off" class="layui-input" style="width:500px;">
		   	</div>
		</div>
		<div class="layui-form-item">
	        <div class="layui-input-block">
	      		<button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
	            <button type="submit" name="submit" lay-submit="" lay-filter="submit1" class="layui-btn" >确认新建</button>
	        </div>
	    </div>
</form>
<script>
layui.use(['form','jquery'],function(){
	$ = layui.jquery;
	var form = layui.form;
	var layer = layui.layer;
	
	form.on('submit(submit1)',function(data){
		console.log(data);
		$.ajax({
			url:'../AdminServlet?button=4'
			,type:'post'
			,data: $("form").serialize()
			,async:false
			,success:function(res){
				console.log(res);
				parent.layer.msg(res);
			}
			,error:function(res){
				parent.layer.msg("系统异常");
			}
		});
		//控制提交成功后窗口自动关闭 
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);
		
	});
});
</script>
</body>
</html>